/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entite;

import connexion.Connexion;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

/**
 *
 * @author asall
 */
public class ListeUe {
     static Connexion con= new Connexion();
        public String libelle;
	public String minChoix;
	public String maxChoix;
	public ArrayList<Ue> eus;


     public ListeUe(String libelle, String minChoix, String maxChoix, ArrayList<Ue> ue){
	this.libelle=libelle;
	this.eus=ue;
	this.minChoix=minChoix;
	this.maxChoix=maxChoix;

	}

   public ListeUe() { }

     public ListeUe getListeUe(int idSemestre){
       Ue unit= new Ue();
      
       

	String libelle=" libelle ue";
	 ArrayList<Ue> u =unit.getUes(1);
	String min= "0";
	String max="10";
	ListeUe ue=new ListeUe(libelle,min, max,u);
        

	try {
		Statement req = con.getInstance().createStatement();

                ResultSet resultatDest = req.executeQuery("select l.id_liste_ue,l.libelle_liste_ue,l.select_max,l.select_min"
                        + " from semestre sem, liste_ue l"
                        + " where l.fid_sem=sem.id_sem  and sem.id_sem= "+ idSemestre );

        	while (resultatDest.next()) {
	         int idListeUe=(resultatDest.getInt("id_liste_ue"));
		 libelle=(resultatDest.getString("libelle_liste_ue"));	
		 min=(resultatDest.getString("select_min"));
		 max=(resultatDest.getString("select_max"));
		 u=unit.getUes(idListeUe);
		
		 ue= new ListeUe(libelle,min,max,u);
		
		}

		} 
	     catch (Exception e) {

			e.printStackTrace();
		}
          
	
       return ue;
}

    
}
